<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../include/laypublic.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>对内结算复制</title>
</head>
<script type="text/html" id="layui-row"  >
    <div class="layui-row" id="{0}" >
        <div class="contract-box" >
            <div class="contract-money">
                <table class="layui-table">
                    <colgroup>
                        <col width="90">
                        <col width="200">
                        <col width="220">
                        <col width="220">
                        <col width="220">
                        <col width="220">
                        <col width="220">
						<col width="150">
						<col width="220">
                    </colgroup>
                    <thead>
                    <tr>
                        <td>子项名称<input type="hidden" value="{1}"  name="subNames"  class="subNames" /></td>
                        <td class="tg-c select" >{1}</td>                         
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
						<td></td>
                        <td></td>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <th>序号</th>
                        <th>费用类型</th>
                        <th>对内合同价(元)（下浮后）</th>
						<th>前期已结算金额(元)</th>
						<th>剩余可结算金额(元)</th>
                        <th>申报金额(元)(下浮前)</th>
                        <th>审核金额(元)(下浮前)</th>
 						<th>对内下浮率(%)</th>
                        <th>审核金额(元)(下浮后)</th>
                    </tr>
                    </tbody>
                    <tbody >
                    <tr id="{0}Row-1" level=1 >
                        <td><span class="label" >1</span><input type="hidden" value="1" name="orderIdxs" /><input type="hidden" value="{1}" name="itemNameSub" /></td>
                        <td  class=tg-c  ><b>建安工程费</b><input type="hidden" value="建安工程费" name="typeNames" class="typeNames" /></td>
                        <td><input type="text" onblur="arabiaToCN(this,1);" name="afterDownFees" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input" /></td>
						<td><input type="text" onblur="arabiaToCN(this,1);" name="addupVerifyAmounts" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input" /></td>
						<td><input type="text" onblur="arabiaToCN(this,1);" name="restVerifyAmounts" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input" /></td>
  						<td><input type="text" onblur="arabiaToCN(this,1);" name="applyPreAmounts" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input appPreAmount" /></td>
                        <td><input type="text" onblur="arabiaToCN(this,1);" name="verifyPreAmounts" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input vfPreAmount" /></td>
 						<td><input type="text" name="innerDownRates" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-inputs innerDownRate" /></td>
                        <td><input type="text" onblur="arabiaToCN(this,1);" name="verifyAfterAmounts" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input vfAfterAmount" /></td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</script>

<script type="text/html" id="layui-row-tr" >
<tr id="{0}" level={1} >
<td><span class="label" >{2}</span><input type="hidden" value="{2}" name="orderIdxs" /><input type="hidden" value="{3}" name="itemNameSub" /></td>
<td class=tg-c><label>{4}</label><input type="hidden" readonly value="{4}" class="layui-input typeNames" name="typeNames" /></td>
<td><input type="text" onblur="arabiaToCN(this,1);" value="{5}" readonly name="afterDownFees" lay-verify="required|floatNumber" style="border:0px;" autocomplete="off" class="layui-input" /></td>
<td><input type="text" onblur="arabiaToCN(this,1);" value="{6}" readonly name="addupVerifyAmounts" lay-verify="required|floatNumber" style="border:0px;" autocomplete="off" class="layui-input" /></td>
<td><input type="text" onblur="arabiaToCN(this,1);" value="{7}" readonly name="restVerifyAmounts" lay-verify="required|floatNumber" style="border:0px;" autocomplete="off" class="layui-input" /></td>
<td><input type="text" onblur="arabiaToCN(this,1);" name="applyPreAmounts" value="{8}" lay-verify="required|floatNumber" autocomplete="off" class="layui-input decimal appPreAmount" /></td>
<td><input type="text" onblur="arabiaToCN(this,1);" name="verifyPreAmounts" value="{9}" lay-verify="required|floatNumber" autocomplete="off" class="layui-input decimal vfPreAmount" /></td>
<td><input type="text" readonly name="innerDownRates" value="{10}" lay-verify="required|floatNumber" style="border:0px;" class="layui-inputs innerDownRate" /></td>
<td><input type="text" onblur="arabiaToCN(this,1);" readonly name="verifyAfterAmounts" value="{11}" lay-verify="required|floatNumber" autocomplete="off" class="layui-input decimal vfAfterAmount" /></td>
</tr>
</script>
<script type="text/html" id="list-mode-tr" >
<tr id="LISTMODERow-{0}"  > 
<td><span class="label" >{0}</span><input type="hidden" value="{0}" name="showIdxLists" /></td> 
<td><input type="text" value="{1}" name="subNameLists" lay-verify="required" readonly style="border:0px;" class="layui-input  subItemListName" /></td>
<td><input type="text" value="{2}" name="subUnitLists" lay-verify="required" readonly style="border:0px;"  class="layui-input  measurementUnit" /></td>
<td><input type="text" value="{3}" name="cotUnitPriceLists" readonly lay-verify="required|floatNumber" style="border:0px;" autocomplete="off" class="layui-input decimal contractPrice" /></td> 
<td><input type="text" value="{4}" name="cotSumPriceLists" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input decimal" /><input type="hidden" value="{5}" name="cotNumLists" class="layui-input" /></td>
<td><input type="text" value="{6}" name="addupVerifyAmountLists" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input addupVerifyAmount" />
<td><input type="text" value="{7}" name="restVerifyAmountLists" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input restVerifyAmount" /> 
<td><input type="text" value="" name="applyNumLists" lay-verify="required|floatNumber" autocomplete="off" class="layui-input decimal applyNumber" /></td>
<td><input type="text" value="" name="applyAmountLists" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input appAmount" /></td> 
<td><input type="text" value="" name="verifyNumLists" lay-verify="required|floatNumber" autocomplete="off" class="layui-input decimal verifyNumber" /></td> 
<td><input type="text" value="" name="verifyAmountLists" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input vfyAmount" /></td> 						
</tr>
</script>

<style>
.list-title{
	display:block;
	width:342px;
	text-align:right;
	left:55px;
	font-size:.89em;
}

.pos-r{
	position: relative;
}
.pos-a{
	position: absolute;
}

.margin-bot10 {
	margin-bottom: 10px;
}

.margin-lt10 {
	margin-left: 10px;
}

.layui-row+.layui-row {
	margin-top: 10px;
}

.tg-l {
	text-align: left;
}

.tg-c {
	text-align: center;
}
.select {
	text-align: center;
    text-align-last: center;
}
.tg-r {
	text-align: right;
}

.contract-list {
	margin-top: 20px;
}

.contract-box {
	width: 100%;
	min-height: 100px;
}

.contract-money {
	width: 94%;
	margin: 0px auto;
}

.contract-money .layui-table {
	margin: 0;
}

.contract-money th {
	text-align: center;
	height: 38px;
}

.contract-money .label {
	display: block;
	width: 45px !important;
	margin-left: 15px;
}

.fieldset {
	margin-top: 5px;
	margin-bottom: 0px
}

.layui-legend {
	background-color: #5fb878;
	font-size: 15px !important;
	width: 140px;
}

.layui-form-item {
	margin-bottom: 5px;
	clear: both;
	*zoom: 1;
}

.layui-form-label {
	width: 160px;
}

</style>
<body>
	<div class="layui-fluid">
		<div class="layui-card">
			<div style="padding-top: 15px;">&nbsp;</div>
			<form class="layui-form" id="addInfo_form" lay-filter="addInfo_form">
				<div class="layui-tab layui-tab-brief" >
					<div class="layui-tab-content">
						<div class="layui-tab-item layui-show">
							<fieldset class="layui-elem-field layui-field-title fieldset"
								id="baseInfo">
								<legend class="layui-btn layui-legend"
									style="text-align: left; cursor: default;">项目基础信息 ></legend>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">申请公司</label>
										<div class="layui-input-inline">
											<input type="hidden" name="hrOrgid" value="${bindOrgId}">
											<input type="text" value="${bindOrgName}"
												style="border: 0px;" readonly="readonly" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">申请部门</label>
										<div class="layui-input-inline">
											<input type="hidden" name="hrDeptid" value="${bindDeptId}">
											<input type="text" value="${bindDeptName}"
												style="border: 0px;" readonly="readonly" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">申请人</label>
										<div class="layui-input-inline">
											<input type="hidden" name="hrStaffApplyid"
												value="${SESSION_KEY_USER_DETAIL.hrStaffId }"> <input
												type="text" name="staffname" value="${SESSION_KEY_USER_DETAIL.realName }"
												readonly="readonly" style="border: 0px" autocomplete="off"
												class="layui-input">
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">合同类型</label>
										<div class="layui-input-inline">
											<input type="text" name="extTypes" value="${innerSettleVo.extType == '1' ? '内部协议': innerSettleVo.extType == '2' ? '分包合同':innerSettleVo.extType == '3' ? '设备合同':'其他合同'}" style="border: 0px;" readonly="readonly" class="layui-input">
											<input type="hidden" id="add_select_extType" name="extType" value="${innerSettleVo.extType}" style="border: 0px;" readonly="readonly" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">合同名称</label>
										<div class="layui-input-inline">
											<input type="text" name="cotName" value="${innerSettleVo.cotName }" style="border: 0px;width:220px" readonly="readonly" class="layui-input">
											<input type="hidden" id="id_code" name="sguid" value="${innerSettleVo.id }">
				      						<input type="hidden" id="proCodes" name="proCodeAndCodes" value="${innerSettleVo.proCode}_${innerSettleVo.refId}_${innerSettleVo.proName}_${innerSettleVo.cotName}" style="border: 0px;width:220px" readonly="readonly" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">项目名称</label>
										<div class="layui-input-inline">
											<input type="text" id="id_proName" name="proName" value="${innerSettleVo.proName}" style="border: 0px;width:220px" readonly="readonly" class="layui-input">
										</div>
									</div>
								</div>	
								<div class="layui-form-item">	
									<div class="layui-inline">
										<label class="layui-form-label">区域公司</label>
										<div class="layui-input-inline">
											<input type="text" value="${innerSettleVo.orgAreaName}" id ="areaId" style="border: 0px;width:220px" 
										 		 readonly="readonly" class="layui-input">
											<input type="hidden" name="hrOrgAreaId" value="${innerSettleVo.hrOrgAreaId}" id ="id_regionalCompany" style="border: 0px;width:220px" 
										 		 readonly="readonly" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">项目公司</label>
										<div class="layui-input-inline">
											<input type="hidden" id="sgCityId" name="sgCityId" value="${innerSettleVo.sgCityId}">
											<input type="hidden" id ="compId" name="hrOrgProId" value="${innerSettleVo.hrOrgProId}">
											<input type="text" value="${innerSettleVo.orgProName}" id ="id_projectCompany" style="border: 0px;width:220px" 
										 		 readonly="readonly" class="layui-input">			
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">实施机构</label>
										<div class="layui-input-inline">
											<input type="text" value="${innerSettleVo.carryOrg}" id="id_ImplementingBody" name="carryOrg"
												style="border: 0px;" readonly="readonly" class="layui-input">
										</div>
									</div>									
								</div>
								<div class="layui-form-item">																		
									<div class="layui-inline">
										<label class="layui-form-label">项目负责人</label>
										<div class="layui-input-inline">
											<input type="text" value="${innerSettleVo.proLeader}" id="id_projectLeader" name="proLeader"
												style="border: 0px;" readonly="readonly" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" >合同单位名称</label>
										<div class="layui-input-inline">
											<input type="hidden" id="sgCoopId" name="sgCoopId" value="${innerSettleVo.sgCoopId}">
											<input type="text" value="${innerSettleVo.sgCoopName}" id="id_contractUnitName"
												style="border: 0px;" readonly="readonly" lay-verify="required|COC"
												class="layui-input">										
										</div>
									</div>	
									<div class="layui-inline" >
										<label class="layui-form-label" >结算部位</label>
										<div class="layui-input-inline" >
											<input type="text" class="layui-input" value="${innerSettleVo.periodMemo }" maxlength="50" id="id_periodMemo" name="periodMemo" lay-verify="required|COC" autocomplete="off" />
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">结算期数</label>
										<div class="layui-input-inline">
											<input type="text" value="${innerSettleVo.periods }" id="id_periods" name="periods"
												style="border: 0px;" readonly="readonly" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">结算模式</label>
										<div class="layui-input-inline">
											<input type="hidden" id="settleTypeId" name="settleType" value="${innerSettleVo.settleType}">
											<input type="text" id="id_settleType" value="${innerSettleVo.settleType == '1' ? '整体下浮':'清单模式'}"
												style="border: 0px;" readonly="readonly" class="layui-input">
										</div>
									</div>								
									<div class="layui-inline" >
										<label class="layui-form-label">本次对内结算金额（元）</label>
										<div class="layui-input-inline">
										<input type="text" id="id_totalSumInner" name="totalSumInner" value="${innerSettleVo.totalSumInner }"
											style="border: 0px;" readonly="readonly" class="layui-input">
										</div>	
									</div>
								</div>								
							</fieldset>
							<c:if test="${innerSettleVo.settleType == '1'}">
							<fieldset class="layui-elem-field layui-field-title fieldset contract-price-info"  >
							<input type="hidden" value="0" name="cotSumPrice" readonly style="border:0px;" class="layui-input" />
							<input type="hidden" value="0" name="applyNums" readonly style="border:0px;" class="layui-input appPreAmount" />
							<input type="hidden" value="0" name="applyAmount" readonly style="border:0px;" class="layui-input vfPreAmount" />
							<input type="hidden" value="0" name="verifyNums" readonly style="border:0px;" class="layui-input innerDownRate" />
							<input type="hidden" value="0" name="verifyAmount" readonly style="border:0px;" class="layui-input vfAfterAmount" />							
								<legend class="layui-btn layui-legend" style="text-align:left;cursor: default;width:175px;" >结算明细-下浮模式 ></legend>
								<div class="contract-list" >																
									<div class="contract-box margin-bot10" >
	            						<div class="contract-money">
	                						<table class="layui-table">
							                    <colgroup>
							                        <col width="90"  >
							                        <col width="290"  >
							                        <col width="290" >
							                        <col width="290" >
							                        <col width="290" >
							                        <col width="290" >
							                    </colgroup>
												<thead>
													<tr>
														<th></th>
														<th>对内合同价(元)(下浮后)</th>
														<th>申报金额(元)(下浮前)</th>
														<th>审核金额(元)(下浮前)</th>
														<th>对内下浮率(%)</th>
														<th>审核金额(元)(下浮后)</th>
													</tr>
												</thead>
												<tbody >
													<tr>
													    <td class="tg-r" >合计</td>
														<td><input type="text" value="${innerSettleVo.afterDownFee}" id="afterDwFee" name="afterDownFee" readonly style="border:0px;" class="layui-input" /></td>
														<td><input type="text" value="${innerSettleVo.applyPreAmount}" id="appPreAmount" name="applyPreAmount" readonly style="border:0px;" class="layui-input " /></td>
														<td><input type="text" value="${innerSettleVo.verifyPreAmount}" id="vfPreAmount" name="verifyPreAmount" readonly style="border:0px;" class="layui-input " /></td>
														<td><input type="text" value="${innerSettleVo.innerDownRate}" id="indiscount" name="innerDownRate" readonly style="border:0px;" class="layui-input " /></td>
														<td><input type="text" value="${innerSettleVo.verifyAfterAmount}" id="vfAfterAmount" name="verifyAfterAmount" readonly style="border:0px;" class="layui-input " /></td>
													</tr>
								                </tbody>
							                </table>
	                    				</div>
                    				</div>					
								</div>
							</fieldset>
							</c:if>
							<c:if test="${innerSettleVo.settleType == '2'}">
							<input type="hidden" value="0" name="afterDownFee" readonly style="border:0px;" class="layui-input" />
							<input type="hidden" value="0" name="applyPreAmount" readonly style="border:0px;" class="layui-input appPreAmount" />
							<input type="hidden" value="0" name="verifyPreAmount" readonly style="border:0px;" class="layui-input vfPreAmount" />
							<input type="hidden" value="0" name="innerDownRate" readonly style="border:0px;" class="layui-input innerDownRate" />
							<input type="hidden" value="0" name="verifyAfterAmount" readonly style="border:0px;" class="layui-input vfAfterAmount" />
							<fieldset class="layui-elem-field layui-field-title fieldset contract-price-info"   >							
								<legend class="layui-btn layui-legend" style="text-align:left;cursor: default;width:175px;" >结算明细--清单模式 ></legend>																	
								<div class="contract-list2" >
									<div class="contract-box margin-bot10">
	            						<div class="contract-money">
	                						<table class="layui-table"	>
							                    <colgroup>
							                        <col width="90"  >
							                        <col width="290"  >
							                        <col width="290" >
							                        <col width="290" >
							                        <col width="290" >
							                        <col width="290" >
							                    </colgroup>
												<thead>
													<tr>
														<th></th>
														<th>合同金额(元)</th>
														<th>结算申报数量</th>
														<th>申报金额(元)</th>
														<th>审核数量</th>
														<th>审核金额(元)</th>
													</tr>
												</thead>
												<tbody>	
													<tr>
													    <td class="tg-r" >合计</td>
														<td><input type="text" value="${innerSettleVo.cotSumPrice}" id="sumPrice" name="cotSumPrice" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input " /></td>
														<td><input type="text" value="${innerSettleVo.applyNums}" id="applyNumber" name="applyNums" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input " /></td>
														<td><input type="text" value="${innerSettleVo.applyAmount}" id="appAmount" name="applyAmount" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input " /></td>
														<td><input type="text" value="${innerSettleVo.verifyNums}" id="verifyNumber" name="verifyNums" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input " /></td>
														<td><input type="text" value="${innerSettleVo.verifyAmount}" id="vfyAmount" name="verifyAmount" readonly lay-verify="required|floatNumber" style="border:0px;" class="layui-input " /></td>
													</tr>																																			
								                </tbody>
							                </table>
	                    				</div>
	                    			</div> 
	                    		</div> 
	                    		<div class="contract-box " id="list-mode" >
            						<div class="contract-money"		>
                						<table class="layui-table"	>
						                    <colgroup>
						                        <col width="90"  >
						                        <col width="200" >
						                        <col width="200" >
						                        <col width="200" >
						                        <col width="200" >
						                        <col width="200" >
						                        <col width="200" >
						                        <col width="200" >
						                        <col width="200" >
						                        <col width="200" >
						                        <col width="200" >
						                    </colgroup>
											<thead>
												<tr>
													<th>序号</th>
													<th>清单名称</th>
													<th>计量单位</th>
													<th>合同单价(元)</th>
													<th>合同金额(元)</th>
													<th>前期已结算金额(元)</th>
													<th>剩余可结算金额(元)</th>
													<th>结算申报数量</th>
													<th>申报金额(元)</th>
													<th>审核数量</th>
													<th>审核金额(元)</th>
												</tr>
											</thead>
											<tbody>	
												<c:forEach items="${innerSettleVo.innerSettleLists}" var="detail" varStatus="status">
								                    <tr>
								                    	<td><input type="text" name="showIdxLists" value="${detail.showIdx }" readonly style="border:0px;" class="layui-input" /></td>
								                    	<td><input type="text" name="subNameLists" value="${detail.subName }" readonly style="border:0px;" class="layui-input  subItemListName" /></td>
								                    	<td><input type="text" name="subUnitLists" value="${detail.subUnit }" readonly style="border:0px;" class="layui-input  measurementUnit" /></td>
								                    	<td><input type="text" name="cotUnitPriceLists" value="${detail.cotUnitPrice }" readonly style="border:0px;" class="layui-input decimal contractPrice" /></td>
								                    	<td><input type="text" name="cotSumPriceLists" value="${detail.cotSumPrice }" readonly style="border:0px;" class="layui-input decimal" /></td>
								                    	<td><input type="text" name="addupVerifyAmountLists" value="${detail.addupVerifyAmount }" readonly style="border:0px;" class="layui-input addupVerifyAmount" /></td>
								                    	<td><input type="text" name="restVerifyAmountLists" value="${detail.restVerifyAmount }" readonly style="border:0px;" class="layui-input restVerifyAmount" /></td>
								                    	<td><input type="text" name="applyNumLists" value="${detail.applyNums }" class="layui-input decimal applyNumber" /></td>
								                    	<td><input type="text" name="applyAmountLists" value="${detail.applyAmount }" readonly style="border:0px;" class="layui-input appAmount" /></td>
								                    	<td><input type="text" name="verifyNumLists" value="${detail.verifyNums }" class="layui-input decimal verifyNumber" /></td>
								                    	<td><input type="text" name="verifyAmountLists" value="${detail.verifyAmount }" readonly style="border:0px;" class="layui-input decimal vfyAmount" />
								                    	<input type="hidden" name="cotNumLists" value="${detail.cotNums }" class="layui-input " /></td>
								                    </tr>
						                      	</c:forEach>																																		
							                </tbody>
						                </table>
                    				</div>
                    			</div>                                      		                    										
							</fieldset>
							</c:if>

							<fieldset class="layui-elem-field layui-field-title fieldset"
								id="baseInfo">
								<legend class="layui-btn layui-legend"
									style="text-align: left; cursor: default;">附件></legend>
								<div style="margin-top: 20px;">
									<div class="layui-form-item">
										<label class="layui-form-label" style="width: 350px;">支持pdf、excel、word、图片资料，可上传多个</label>
									</div>
									<div class="layui-form-item">
									    <label class="layui-form-label">计算稿（选填）</label>
									    <div class="layui-input-block">
									    	<div class="layui-upload">
								              	<button type="button" class="layui-btn" id="1-upload-more">上传</button>
						                		<div class="layui-upload-list" id="1-upload-more-list">
						                			<c:forEach items="${innerSettleVo.innerSettleAtts }" var="fileAtt">
								              			<c:if test="${fileAtt.types == '1' }">
								              				<div class="layui-upload-img-div" id="upload_img_${fileAtt.id }">
								              					<c:choose>
									              					<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
										              					<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
										              				</c:when>
										              				<c:otherwise>
										              					<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
										              				</c:otherwise>
								              					</c:choose>
								              					<div class="mask">
								              						<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
								              						<a href="javascript:void(0)" onclick="del('${fileAtt.id}')">删除</a>
								              						<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix }||${fileAtt.filePath }" id="fileAtt_${fileAtt.id}" name="fileAtts1" ></input>
								              					</div>
								              					<p>${fileAtt.fileName}</p>
								              				</div>
								              			</c:if>
								              		</c:forEach>
						                		</div>
								            </div>
									    </div>
								  	</div>
									<div class="layui-form-item">
									    <label class="layui-form-label">签字扫描件（选填）</label>
									    <div class="layui-input-block">
									    	<div class="layui-upload">
								              	<button type="button" class="layui-btn" id="2-upload-more">上传</button>
						                		<div class="layui-upload-list" id="2-upload-more-list">
						                			<c:forEach items="${innerSettleVo.innerSettleAtts }" var="fileAtt">
								              			<c:if test="${fileAtt.types == '2' }">
								              				<div class="layui-upload-img-div" id="upload_img_${fileAtt.id }">
								              					<c:choose>
									              					<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
										              					<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
										              				</c:when>
										              				<c:otherwise>
										              					<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
										              				</c:otherwise>
								              					</c:choose>
								              					<div class="mask">
								              						<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
								              						<a href="javascript:void(0)" onclick="del('${fileAtt.id}')">删除</a>
								              						<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix }||${fileAtt.filePath }" id="fileAtt_${fileAtt.id}" name="fileAtts2" ></input>
								              					</div>
								              					<p>${fileAtt.fileName}</p>
								              				</div>
								              			</c:if>
								              		</c:forEach>
						                		</div>
								            </div>
									    </div>
								  	</div>
									<div class="layui-form-item">
									    <label class="layui-form-label">其他附件（选填）</label>
									    <div class="layui-input-block">
									    	<div class="layui-upload">
								              	<button type="button" class="layui-btn" id="3-upload-more">上传</button>
						                		<div class="layui-upload-list" id="3-upload-more-list">
						                			<c:forEach items="${innerSettleVo.innerSettleAtts }" var="fileAtt">
								              			<c:if test="${fileAtt.types == '3' }">
								              				<div class="layui-upload-img-div" id="upload_img_${fileAtt.id }">
								              					<c:choose>
									              					<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
										              					<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
										              				</c:when>
										              				<c:otherwise>
										              					<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
										              				</c:otherwise>
								              					</c:choose>
								              					<div class="mask">
								              						<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
								              						<a href="javascript:void(0)" onclick="del('${fileAtt.id}')">删除</a>
								              						<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix }||${fileAtt.filePath }" id="fileAtt_${fileAtt.id}" name="fileAtts3" ></input>
								              					</div>
								              					<p>${fileAtt.fileName}</p>
								              				</div>
								              			</c:if>
								              		</c:forEach>
						                		</div>
								            </div>
									    </div>
								  	</div>
								</div>
							</fieldset>

						</div>
					</div>
				</div>

				<div class="layui-form-item"
					style="position: fixed ! important; right: 30px; bottom: 45%; z-index: 10000;">
					<div class="layui-input-block">
						<button
							class="layui-btn layui-bg-blue layui-btn-normal layui-btn-lg  layui-btn-radius"
							type="button" lay-submit lay-filter="addInfo_form_submit"
							id="addInfo_form_submit">
							<i class="layui-icon layui-icon-ok layuiadmin-button-btn"></i> 提交
						</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>
</html>
<script>
String.prototype.format = function () {
	var model = arguments;
    return this.replace(/\{(\d+)\}/g, function (s, i) { 
        return model[i];
    });
}
String.prototype.toInt = function () {
	if(this==''){
		return 0;
	}
	return parseInt(this);
}
String.prototype.toFloat = function () {
	if(this==''){
		return 0;
	}
	return parseFloat(this);
}
Number.prototype.toMoney = function () {
	var m = Math.pow(10, 2);
	return Math.round(this * m) / m;
}

var setDecimalPlaces = function(f, digit) {
	var m = Math.pow(10, digit);
	return Math.round(f * m) / m;
}
	
function parentGroup($, type, id,area) {
	countTopRows($, [type],area);
}

function countTopRows($, types, $area) {
	if(types == ''){
		return;
	}
	var $contractListLayuiRow = $area.find('.layui-row');
	$contractListLayuiRow.each(function() {		
		var id = $(this).attr('id');
		types.forEach(function(e) {
			if(e=='vfAfterAmount'){
				var $vfPreAmount =$("tr[id='" + id + "Row-1'] input[type=text].vfPreAmount");
				var $innerDownRate =$("tr[id='" + id + "Row-1'] input[type=text].innerDownRate");
				var vfPreAmount = $vfPreAmount.val().toFloat();
				var innerDownRate = $innerDownRate.val().toFloat()*0.01;
				var $vfAfterAmount =$("tr[id='" + id + "Row-1'] input[type=text]." + e);
				var vfAfterAmount = vfPreAmount*(1-innerDownRate);
				$vfAfterAmount.val(vfAfterAmount.toFixed(2));
			}else{
				var $total =$("tr[id='" + id + "Row-1'] input[type=text]." + e);						
				var total = $("tr[id^='sub" + id + "Row-1.'] input[type=text]." + e).inputTotal();
				$total.val(total);
			}			
		});
	});
	
	types.forEach(function(e) {		
		var $total = $('#' + e);
		var total = $contractListLayuiRow.find("tr[id$='Row-1'] input[type=text]." + e).inputTotal();
		$total.val(total);
		if(e == 'vfAfterAmount'){
			$("#id_totalSumInner").val(total);			
		}
	});
}

	var proName;
	var proNameid;
	//静态资源路径前缀
	var staticPath = '${fileHttpPre}';
	/* var stateJSON = <infopub:dicJson groupNo="A00010028" />; */

	layui.config({
				base : '${ctx}/resources/layuiadmin/' //静态资源所在路径
			})
			.extend({
				index : 'lib/index' //主入口模块
			})
			.use(['index', 'set', 'upload', 'element', 'laydate' ],
					function() {

						var $ = layui.$, form = layui.form, element = layui.element, laydate = layui.laydate, upload = layui.upload;
						(function($) {
							$.fn.inputTotal = function() {
								var sum = 0;
								this.each(function() {
									var thisNum = $(this);
									var val = !!thisNum.val() ? thisNum.val()
											: 0;
									var num = parseFloat(val);
									sum = setDecimalPlaces(sum + num, 2);
								});
								return sum;
							};
						})($);
						// 正则校验
						form.verify({
							//验证汉字
						    CHS:[
						    	/^[\u0391-\uFFE5]+$/
						    	,'只能输入汉字'
						  	],
						  	//名字校验
						  	COC: [
								/^[\u4e00-\u9fa5_a-zA-Z0-9]+$/
								,'请输入正确的名称'
						  	],
						  	//大于0的正整数
						  	intNumber:[
								/^[1-9]\d*$/
								,'请输入正确的数字'
						  	],
						  	//数字只能有两位小数
						  	floatNumber:[
								/^([-]?)([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
								,'请输入正确的数字'
						  	],
						  	telNumber:[/^[1][3,4,5,7,8,9][0-9]{9}$/
								  		,'请输入正确的号码'
							],
						  	//数字大于0，并只能有两位小数
						  	floatAmount:[
								/^([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
								//var pattern=/^((\d+\.\d*[1-9]\d{1})|(\d*[1-9]\d*\.\d{2}))$/; 
								,'请输入正确的数字'
						  	]
						});
						uploadRender(1,upload,$);
						uploadRender(2,upload,$);
						uploadRender(3,upload,$);
						
						var listModeData = [];
						listModeDataBind($,listModeData);
						
						var id = $("#id_code").val();
						$.ajax({
							type : "POST", //提交方式  
							url : "${ctx}/innerSettle/getInnerSettleById",//路径  
							data : { "sguid" : id
							},//数据，这里使用的是Json格式进行传输  
							success : function(result) {//返回数据根据结果进行相应的处理 					
								if (result.flag == true) {
									if(result.innerSettleVo.extType=='1'){//内部协议																				
										var details =result.innerSettleVo.innerSettleSubVos;
										if(details!=null&&details!=''&&details.length>0){
											var hash = {},subList=[];
											for(var k=0;k<details.length;k++){
												for(var i = 0, j = details[k].innerSettleDetails.length; i < j; i++) {												
													var e = details[k].innerSettleDetails[i];						
													if(typeof(hash[e.settleSubId])=='undefined'){
														hash[e.settleSubId] = subList.length;							
														subList.push({															
															subName:details[k].subName,
															subId:e.settleSubId,
															list:[{
																subRowId : e.orderIdx.indexOf(',')!=-1?e.orderIdx.split(',')[1]:e.orderIdx,
																typeName : e.typeName,
																afterDownFee : e.afterDownFee,
																addupVerifyAmount : e.addupVerifyAmount,
																restVerifyAmount : e.restVerifyAmount,
																applyPreAmount : e.applyPreAmount,
																verifyPreAmount : e.verifyPreAmount,
																innerDownRate : e.innerDownRate,
																verifyAfterAmount : e.verifyAfterAmount
															}]
														});							

													}else{								
														var index =  hash[e.settleSubId].toString().toInt();
														subList[index].list.push({
															subRowId : e.orderIdx.indexOf(',')!=-1?e.orderIdx.split(',')[1]:e.orderIdx,
															typeName : e.typeName,
															afterDownFee : e.afterDownFee,
															addupVerifyAmount : e.addupVerifyAmount,
															restVerifyAmount : e.restVerifyAmount,
															applyPreAmount : e.applyPreAmount,
															verifyPreAmount : e.verifyPreAmount,
															innerDownRate : e.innerDownRate,
															verifyAfterAmount : e.verifyAfterAmount
														});						
													}						
												}
											}	
										}								
										//调用下浮模式方法
										overallDownwardFloat($,subList);
										
										$('.contract-price-info:eq(1)').css('display','none');
										$('.contract-price-info:eq(1)').find("input").removeAttr("lay-verify");
										$('.contract-price-info:eq(0)').css('display','block');
									}else if(result.innerSettleVo.extType=='2'){//分包合同									
										//分包合同整体下浮模式
										if(result.innerSettleVo.settleType=='1'){
											//带出整体下浮明细
											var details =result.innerSettleVo.innerSettleSubVos;
											if(details!=null&&details!=''&&details.length>0){
												var hash = {},subList=[];
												for(var k=0;k<details.length;k++){
													for(var i = 0, j = details[k].innerSettleDetails.length; i < j; i++) {												
														var e = details[k].innerSettleDetails[i];						
														if(typeof(hash[e.settleSubId])=='undefined'){
															hash[e.settleSubId] = subList.length;							
															subList.push({
																subName:details[k].subName,
																subId:e.settleSubId,
																list:[{
																	subRowId : e.orderIdx.indexOf(',')!=-1?e.orderIdx.split(',')[1]:e.orderIdx,
																	typeName : e.typeName,
																	afterDownFee : e.afterDownFee,
																	addupVerifyAmount : e.addupVerifyAmount,
																	restVerifyAmount : e.restVerifyAmount,
																	applyPreAmount : e.applyPreAmount,
																	verifyPreAmount : e.verifyPreAmount,
																	innerDownRate : e.innerDownRate,
																	verifyAfterAmount : e.verifyAfterAmount
																}]
															});							

														}else{								
															var index =  hash[e.settleSubId].toString().toInt();
															subList[index].list.push({
																subRowId : e.orderIdx.indexOf(',')!=-1?e.orderIdx.split(',')[1]:e.orderIdx,
																typeName : e.typeName,
																afterDownFee : e.afterDownFee,
																addupVerifyAmount : e.addupVerifyAmount,
																restVerifyAmount : e.restVerifyAmount,
																applyPreAmount : e.applyPreAmount,
																verifyPreAmount : e.verifyPreAmount,
																innerDownRate : e.innerDownRate,
																verifyAfterAmount : e.verifyAfterAmount
															});						
														}						
													}
												}	
											}
											
											//调用下浮模式方法
											overallDownwardFloat($,subList);
											
											$('.contract-price-info:eq(1)').css('display','none');	
											$('.contract-price-info:eq(1)').find("input").removeAttr("lay-verify");
											$('.contract-price-info:eq(0)').css('display','block');
											
										}
									}
									form.render();
								}
							}
						});
			
						form.on('submit(addInfo_form_submit)',function (data) {
		                	$("#addInfo_form_submit").removeAttr("lay-submit").removeClass("layui-bg-blue").addClass("layui-btn-disabled");
		              		layer.load();
		                   	//提交 Ajax 成功后，静态更新表格中的数据
		                   	$.ajax({
		                       	type : 'post',
		            			url : basePath + '/innerSettle/save',
		                       	data: $('#addInfo_form').serialize(),
		            			success:function(result){
		            				if(result.success){
		            					layer.closeAll('loading'); //关闭loading
		            					layer.msg('提交单据成功~',{icon: 1});
		            					//两秒后关闭当前页面
		            					setTimeout(function(){
		            						/**
		            						 * 查找父菜单，并刷新
		            						 */
		            						var topDoc = $(window.top.document);
		            						var path = basePath + '/innerSettle/list';
		            						// 获取页面名称
		            						var name = topDoc.find(".layui-nav-item [lay-href^='" + path + "']").text();
		            						if(name == '' || name == null){
		            							name = '对内结算';
		            						}
		            						window.parent.layui.index.openTabsPage(path, name);
		            						var iframe = window.parent.layui.admin.tabsBody(window.parent.layui.admin.tabsPage.index).find(".layadmin-iframe");
		            						iframe[0].contentWindow.location.reload(true);
		            						
		            						/**
		            						 * 关闭当前页
		            						 */
		            						var currPath = basePath + '/innerSettle/toCopy';
		            						var layid = topDoc.find("li[lay-id^='" + currPath + "']").attr('lay-id');
		            						window.parent.layui.element.tabDelete('layadmin-layout-tabs', layid);//关闭当前页
		            				        }, 2000);
		            				}else{
		            					layer.closeAll('loading'); //关闭loading
		              					$("#addInfo_form_submit").removeClass("layui-btn-disabled").addClass("layui-bg-blue").attr("lay-submit","");
		            					layer.msg(result.msg,{icon: 7});
		            			  	}
		            			}
		                   	});

		                });
		            });
	//计算下浮模式时候的审核金额（下浮后）
	var calVfAfterAmount = function($,type,$tr){
		if(type=='vfPreAmount'  ){			
			var vfPreAmount = $tr.find(".vfPreAmount").val().toFloat();			
			var $innerDownRate = $tr.find(".innerDownRate"),innerDownRate = $innerDownRate.val().toFloat()*0.01;
			
			var $vfAfterAmount = $tr.find(".vfAfterAmount"),vfAfterAmount = vfPreAmount * (1-innerDownRate);
			$vfAfterAmount.val(vfAfterAmount.toMoney());													
		}		
	}
	
	var overallDownwardFloat=function($,subList){	
		var form = layui.form
		var $contractList = $('.contract-list'),
		layuiRowHtml = $('#layui-row').html();	
		$contractList.find(".layui-row").remove();
		
		var afterDwFeeTotal = 0;
		for (var i = 0, j = subList.length; i < j; i++) {
			var itemSubName = subList[i].subName,subId = subList[i].subId;
			var tempHtml = layuiRowHtml.format(subId,itemSubName);
			var $html = $(tempHtml);			
			subList[i].list.forEach(function(e){
				var subRowId = e.subRowId;
				var typeName = e.typeName;
				var afterDwFee = e.afterDownFee;
				var addupVerifyAmount = e.addupVerifyAmount;
				var restVerifyAmount = e.restVerifyAmount;
				var applyPreAmount = e.applyPreAmount;
				var verifyPreAmount = e.verifyPreAmount;
				var innerDownRate = e.innerDownRate;	
				var verifyAfterAmount = e.verifyAfterAmount;
				var arr = subRowId.split('.');
				var level = arr.length;
				if(level == 1){
					var $rowFirst = $html.find('tr[id="'+subId + 'Row-' + subRowId + '"]');
					var $typeNames = $rowFirst.find('td:eq(1) input.typeNames');											
					if ($typeNames.val() != typeName) {
						$typeNames.val(typeName);
					}
					
					$rowFirst.find('td:eq(2) input').val(afterDwFee);
					$rowFirst.find('td:eq(3) input').val(addupVerifyAmount);
					$rowFirst.find('td:eq(4) input').val(restVerifyAmount);
					$rowFirst.find('td:eq(5) input').val(applyPreAmount);
					$rowFirst.find('td:eq(6) input').val(verifyPreAmount);
					$rowFirst.find('td:eq(7) input').val(innerDownRate);
					$rowFirst.find('td:eq(8) input').val(verifyAfterAmount);
					afterDwFeeTotal = afterDwFeeTotal + afterDwFee;
				}else if (level >= 2) {
					var id = "sub"+subId+"Row-"+subRowId;												
					var types = subRowId.split('.');        
					var $trHtml = $($('#layui-row-tr').html().format(id,level,subRowId,itemSubName,typeName,afterDwFee+"",
							addupVerifyAmount+"",restVerifyAmount+"",applyPreAmount+"",verifyPreAmount+"",innerDownRate+"",verifyAfterAmount+""));
					
					var pop = arr.pop();
					var parent = subId + 'Row-' + arr[0];												
					var siblings = 'sub' + parent + '.';
					var $parent = $html.find("tr[id='" + parent + "']");
					var $siblings = $html.find("tr[id^='" + siblings + "']");
					var siblingslen = $siblings.length;						
					if (siblingslen > 0) {
						var $last = $($siblings[siblingslen - 1]);
						var lastId = $last.prop('id');
						if (lastId.split('.').pop() == pop - 1) {
							$last.after($trHtml);													 
						}
					} else if ($parent.length == 1 && pop == '1') {
						$parent.after($trHtml);
					}											
				}
			});					
			$contractList.append($html);
		}
		$contractList.on('keyup','.decimal', function() {
			var val = this.value.replace(
					/^(\-)*(\d+)\.(\d\d).*$/,
					'$1$2.$3');
			var val2 = val.replace(/[^0-9.]/g,
					"");
			this.value = val2;
		}).on('blur','.layui-row .contract-money input[type=text]:not([readonly].decimal)',function() {
				var $tr = $(this).parents('tr');
				var type, id;
				type = $(this).prop('class')
						.replace('layui-input', '')
						.replace('decimal', '')
						.trim();
				id = $tr.prop("id");
				calVfAfterAmount($,type,$tr);
				parentGroup($, type, id,$contractList);
				countTopRows($, ['vfAfterAmount'],$contractList);
				/* if(!$(this).hasClass("typeNames") && !$(this).hasClass("innerDownRate")){
					arabiaToCN(this,1);
				} */
			});
		$("#afterDwFee").val(afterDwFeeTotal.toFixed(2));
	}

	var listModeDataBind = function($,listModeData){
		var $table = $('#list-mode').find('tbody');
		/* $table.empty(); */
		var template = $('#list-mode-tr').html();		
		$table.on('keyup','.decimal', function() {
			var val = this.value.replace(
					/^(\-)*(\d+)\.(\d\d).*$/,
					'$1$2.$3');
			var val2 = val.replace(/[^0-9.]/g,
					"");
			this.value = val2;
		}).on('keyup','.integer', function() {
			var val = this.value.replace(/^(\-)*([1-9]\d*)\.(\d\d).*$/,'$2');
			var val2 = val.replace(/[^0-9.]/g,"");
			this.value = val2;
		}).on('blur','.applyNumber,.verifyNumber', function() {
			var $tr = $(this).parents('tr'); sumPrice($tr);
			var appNumTotal = $table.find(".applyNumber").inputTotal();
			if(appNumTotal > 0){
				$("#applyNumber").val(appNumTotal);
				var appAmountTotal = $table.find(".appAmount").inputTotal();
				$("#appAmount").val(appAmountTotal);
			}else{
				$("#applyNumber").val('');
				$("#appAmount").val('');
			}
			var verNumberTotal = $table.find(".verifyNumber").inputTotal();
			if(verNumberTotal > 0){
				$("#verifyNumber").val(verNumberTotal);
				var vfyAmountTotal = $table.find(".vfyAmount").inputTotal();
				$("#vfyAmount").val(vfyAmountTotal);
				$("#id_totalSumInner").val(vfyAmountTotal);
			}else{
				$("#verifyNumber").val('');
				$("#vfyAmount").val('');
				$("#id_totalSumInner").val(0);
			}
		});	
		for(var i=0,j=listModeData.length;i<j;i++){
			var html=[],rowId=i+1;
			var item = listModeData[i];
			var rowHtml = template.format(rowId,item.subItemListName,item.measurementUnit,item.contractPrice,item.sumPrice
					,item.cotNums,item.addupVerifyAmount,item.restVerifyAmount);
			var $rowHtml = $(rowHtml);
			$table.append($rowHtml);
		}
		function sumPrice($tr){
			$contractPrice = $tr.find('.contractPrice'),
			$applyNumber = $tr.find('.applyNumber'),
			$verifyNumber = $tr.find('.verifyNumber'),
			$sumPrice = $tr.find('.appAmount');
			if($applyNumber.val() != ''){
				var applynumber = $applyNumber.val().toFloat(),price = $contractPrice.val().toFloat(),sumPrice = applynumber * price;			
				$sumPrice.val(sumPrice.toMoney());
			}
			if($verifyNumber.val() != ''){
				$vfyAmount = $tr.find('.vfyAmount');
				var vernumber = $verifyNumber.val().toFloat(),price = $contractPrice.val().toFloat(),verPrice = vernumber * price;			
				$vfyAmount.val(verPrice.toMoney());
			}
		}
	}
	
    var uploadRender = function(id,upload,$) {
        upload.render({
                elem : '#' + id + '-upload-more',
                url : basePath
                    + '/innerSettle/uploadAtt/',
                data : {
                    types : id
                },
                multiple : true,
                accept : 'file',
                acceptMime : 'application/zip,application/x-rar-compressed,image/jpeg,image/png,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/pdf',
                before : function(obj) {
                    layer.load();
                },
                done : function(res) {
                    if (res.code > 0) {
                        layer.closeAll('loading');
                        return layer.msg(res.msg, {
                            icon : 7
                        });
                    }
                    if (res.entity != null
                        && res.entity.length > 0) {
                        for ( var i in res.entity) {
                            var preProject = res.entity[i];
                            var arr = preProject
                                .split("|");
                            var imgSrc = "";
                            var suffix = arr[1]
                                .substring(
                                    arr[1]
                                        .lastIndexOf(".") + 1,
                                    arr[1].length);
                            if (suffix == 'jpg'
                                || suffix == 'png') {
                                imgSrc = "${fileHttpPre}/"
                                    + arr[3];
                            } else {
                                imgSrc = "${ctx}/resources/images/"
                                    + suffix
                                    + ".jpg";
                            }
                            $(
                                '#'
                                + id
                                + '-upload-more-list')
                                .append(
                                    '<div class="layui-upload-img-div" id="upload_img_'+arr[2]+'"><img src="'+imgSrc+'" title="'+ arr[1] +'" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\''
                                    + "${fileHttpPre}"
                                    + arr[3]
                                    + '\');">查看</a><a href="javascript:void(0)" onclick="del(\''
                                    + arr[2]
                                    + '\')";>删除</a></div><p>'
                                    + arr[1]
                                    + '</p><input type="hidden" value="'+preProject+'" id="fileAtt_'+arr[2]+'" name="fileAtts'+id+'" ></input></div>');
                        }
                    }
                },
                allDone : function(obj) {
                    layer.closeAll('loading');
                },
                error : function() {
                    layer.closeAll('loading');
                    layer.msg("上传失败，请稍后再试~", {
                        icon : 7
                    });
                }
            });
    }
  	//删除文件
	function del(index){
		layui.$("#fileAtt_"+index).remove();
		layui.$("#upload_img_"+index).remove();
	}
  
	//根据url查看文件
	function showImg(url){
		var openWin = window.open(url,'','left=410,height=768, width=1024, top=200,  toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
	}
	function formatNum(num) {
	    var str = num.toString();
	    if (-1 == str.indexOf(".")) {
	        str = str + ".00"
	    }
	    if (-1 != str.indexOf(",")) {
	        str = str.replace(new RegExp(',', "g"), "")
	    }
	    var intSum = str.substring(0, str.indexOf(".")).replace(/\B(?=(?:\d{3})+$)/g, ',');
	    var dot = str.substring(str.length, str.indexOf("."));
	    var ret = intSum + dot;
	    return ret;
	}
	
	function setReadonly($t) {
		if ($t) {
			$t.find('input[type=text].incontractfee').prop('readonly', true).removeAttr('lay-verify');
		}
	}
	//'请输入正确数字，且保留两位小数！'
	function isNumberAndFloat(str) {
		var rgx = /^([-]?)([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;

		var boolrgx = rgx.test(str);// true 
		if (boolrgx) {
			return true;
		} else {
			return false;
		}
	}
</script>